package com.ftd.config;

/**
 * Created by apple on 2016/12/9.
 */

public enum ResultType {
    SUCCESS_ALL("成功",0),
    HAS_BEEN_REGISTERED("用户名已被注册",1),
    WRONG_USERNAME("用户名不存在",2),
    WRONG_PASSWORD("密码错误",3),
    WRONG_ALL("用户信息不正确",4);

    private String name;
    private int index;
    private ResultType(String name, int index){
        this.name = name;
        this.index = index;
    }
    public static String getName(int index){
        for (ResultType c : ResultType.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    // get set 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
